/************************************************************************************************
 * test examples of 100 interesting program in C
 * test 033.c
 * Prime number of palindrome
 * Generator of palindrome
 ***********************************************************************************************/

#include <stdio.h>

#define WIDTH 5

/*
 * I will finish this after learning Stack.
 */

int generatePalindrome(int n, int width)
{
    int i, j = 1, k;
    if (width > WIDTH)
        return;
    else if (n % 10 != 0)
        printf("%d ", n);
    for (i = 0; i < width; i++, j *= 10);
    for (k = 0; k < 10; k++)
        generatePalindrome((j*k+n)*10+k, width+2);
}

int main()
{
    int i, j;
    generatePalindrome(0, 0);
    for (i = 0; i < 10; i++)
        generatePalindrome(i, 1);
    printf("\n");
}

